package Records.MusicPlayer;

import Records.MusicPlayer.MusicPlayer;

/**
 *
 * @author Alexander
 */
public class PlayerUserInterface {

    private static MusicPlayer musicPlayer = null;
    private static String Status;

    public static void PlayButton(String CurrentSongPath, String Location, String Title) {
        System.out.println("PlayerUserInterface.PlayButton(" + CurrentSongPath + ", " + Location + ", " + Title + ")");

        System.out.println("Now playing " + CurrentSongPath);
        MusicPlayer.setPauseTime(0);
        MusicPlayer.setResumeTime(0);
        MusicPlayer.setTimeWaste(0);
        MusicPlayer.setMostCurrentLocation(Location);
        musicPlayer = new MusicPlayer(CurrentSongPath, Location);
        getmusicPlayer().start();
        setStatus("PLAYING");
    }

    public static void PauseButton() {
        System.out.println("PlayerUserInterface.PauseButton()");
        if (getmusicPlayer() != null) {
            getmusicPlayer().pausePlayback();
            setStatus("PAUSED");
            System.out.println("Paused");
        }
    }

    public static void ResumeButton() {
        System.out.println("PlayerUserInterface.PauseButton()");
        if (getmusicPlayer() != null) {
            getmusicPlayer().resumePlayback();
            PlayerUserInterface.setStatus("PLAYING");
            System.out.println("Resume");
        }
    }

    public static void StopButton() {
        System.out.println("PlayerUserInterface.StopButton()");
        if (getmusicPlayer() != null) {
            getmusicPlayer().close();
            PlayerUserInterface.setStatus("STOPPED");
            System.out.println("Stopped");
        }
    }

    /**
     * @return the mp4
     */
    public static MusicPlayer getmusicPlayer() {
        return musicPlayer;
    }

    /**
     * @return the Status
     */
    public static String getStatus() {
        return Status;
    }

    /**
     * @param Status the Status to set
     */
    public static void setStatus(String status) {
        System.out.println("PlayerUserInterface.setStatus(" + status + ")");
        Status = status;
    }
}
